package com.li.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.li.entity.PageResult;
import com.li.entity.QueryPageBean;
import com.li.entity.Result;
import com.li.pojo.Order;
import com.li.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisPool;

import java.util.List;

/**
 * 预约
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Reference
    private OrderService orderService;
    @Autowired
    private JedisPool jedisPool;
    @RequestMapping("/findOrders")
    public Result findOrders(@RequestBody QueryPageBean queryPageBean) {
        jedisPool.getResource().set("fail", "");
        PageResult pageResult =  orderService.findOrders(queryPageBean);

        return new Result(true, "",pageResult);
    }

    @RequestMapping("/deleteOrder")
    public Result deleteOrder(Integer id) {
        orderService.deleteOrderById(id);
        return new Result(true, "");
    }

}
